package com.woniuxy.factory.controller;

import com.woniuxy.factory.entity.ResponseResult;
import com.woniuxy.factory.entity.WorkShop;
import com.woniuxy.factory.service.WorkShopService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.List;

@Controller
@RequestMapping("/workshop")
public class WorkShopController {
    @Autowired
    WorkShopService workShopService;
    //查询所有车间信息
    @ResponseBody
    @RequestMapping("/show")
    public ResponseResult showWorkShop() {
        ResponseResult<Object> res = new ResponseResult<>();
        //查询业务逻辑
        List<WorkShop> workShops = workShopService.findWorkShop();
        //装配
        res.setCode(0);
        res.setMsg("查询成功");
        res.setData(workShops);
        return res;
    }
}
